package com.chzc.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 单个商品对象
 * @author cv大魔王
 * @version 1.0
 * @date 2021/6/6 16:25
 */
@Data
@ApiModel(value = "单个购物车商品对象", description = "单个购物车商品对象")
public class GoodsItemCarVO implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "商品ID")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;

    @ApiModelProperty(value = "商品标题")
    private String goodsTitle;

    @ApiModelProperty(value = "商品图片")
    private String goodsImg;

    @ApiModelProperty(value = "商品简介")
    private String goodsContent;

    @ApiModelProperty(value = "商品单价")
    private BigDecimal goodsPrice;

    @ApiModelProperty(value = "秒杀价")
    private BigDecimal seckillPrice;

    @ApiModelProperty(value = "秒杀开始时间")
    private Date startDate;

    @ApiModelProperty(value = "秒杀结束时间")
    private Date endDate;

    @ApiModelProperty(value = "总价格，单价+数量")
    private Double totalPrice;

    @ApiModelProperty(value = "购买数量")
    private Integer buyNum;

    /**
     * 商品单价 * 购买数量
     * @return
     */
    public Double getTotalPrice() {
        return (this.seckillPrice.multiply(BigDecimal.valueOf(this.buyNum))).doubleValue();
    }
}
